home *** CD-ROM | disk | FTP | other *** search
-
- /*
- ** token.c
- **
- ** tokenizes an input string, returning number of
- ** tokens found.
- */
- #include "cb.h"
-
- tokenize(str,list,llen)
- char *str;
- char *list[];
- int llen;
- {
- int i;
- int count = 0;
-
- for (i=0;i<llen;i++)
- list[i] = NULL;
-
- if (!strlen(str))
- return(0);
-
- if ((list[count] = strtok(str, " ")) != NULL)
- {
- count++;
- while ((count < llen) &&
- ((list[count] = strtok(NULL," ")) != NULL))
- count++;
- }
- return(count);
- }
-